  var table = layui.table;

  initTable({
	 elem: '#config-t'
    ,url: ctx+'/sys/config/getPage'
    ,cols: [[
       {field:'configId', title: 'ID', hide: true}
      ,{field:'configName', minWidth:150, title: '参数名称', sort: true}
      ,{field:'configCode', minWidth:150, title: '参数编码', sort: true}
      ,{field:'configValue', minWidth:150,  title: '参数值', sort: true}
      ,{field:'remark', minWidth:150, title: '备注'}
      ,{
			title: '操作',
			align: 'center',
			toolbar: '#config-t-tool',
			fixed: 'right',
			minWidth: 180,	
		}
    ]]
  })

    //条件搜索
  $("#configSearch").click(function(){
	    var searchData = $("#configSearchForm").serializeObject();
		layui.table.reload('config-t', {
			where : searchData,
			page : {
				curr : 1
			}
		});
  })
    
  
  //监听表行工具栏
  table.on('tool(config-t)', function(obj){
    var data = obj.data;
    var id = data.configId;
   if(obj.event === 'edit'){
		var url = ctx+"/sys/config/editView?id="+id;
		$.get(url, {}, function(res){
			if(!isJSON(res)){
			  var index = layer.open({
					type: 1,
					title: '编辑',
					skin: 'layui-layer-rim', 
					area: ['30%', '50%'],
					offset: ['5%', '20%'],
			        content: res,
					btn: [],
					end: function(){
						tableReload();
					}
			  		,maxmin: true
			  });
			  layer.full(index);
			}
		  });
    }
  });
  
